package com.example.rjxmgl.controller;


import com.example.rjxmgl.service.CourseService;
import com.example.rjxmgl.utils.ResultMessage;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;




/**
 * 课程表
 *
 * @author khai 951992121@qq.com
 * @since 1.0.0 2024-12-05
 */
@RestController
@RequestMapping("staff/course")
@Api(tags = "课程表")
public class CourseController {

    @Autowired
    private CourseService courseService;

    @PostMapping("/listCourse/{studentId}")
    @Operation(summary = "展示课程列表")
    public ResultMessage listCourse(@PathVariable("studentId")Long studentId){
        return courseService.listCourse(studentId);
    }

    @PostMapping("/chooseCourse/{studentId}/{courseId}")
    @Operation(summary = "选课")
    public ResultMessage chooseCourse(@PathVariable("studentId")Long studentId,
                                      @PathVariable("courseId")Long courseId){
        return courseService.chooseCourse(studentId,courseId);
    }

    @PostMapping("/noChooseCourse/{studentId}/{courseId}")
    @Operation(summary = "取消选课")
    public ResultMessage noChooseCourse(@PathVariable("studentId")Long studentId,
                                        @PathVariable("courseId")Long courseId){
        return courseService.noChooseCourse(studentId,courseId);
    }


}